<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <%@include file="../common.jsp" %>
    <link rel="stylesheet" href="<c:url value="/lib/jq-module/zyupload/zyupload-1.0.0.min.css" />" media="all">
    <script src="<c:url value="/lib/jq-module/zyupload/zyupload-1.0.0.min.js" />" charset="utf-8"></script>
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>
<body>
<%--<div class="layui-form layuimini-form" id="form">--%>
<%--    <div class="layui-form-item">--%>
<%--        <label class="layui-form-label required">菜单名称</label>--%>
<%--        <div class="layui-input-block">--%>
<%--            <input type="text" name="menuName" lay-verify="required" lay-reqtext="菜单名称不能为空" placeholder="请输入菜单名称"--%>
<%--                   value="" class="layui-input">--%>
<%--        </div>--%>
<%--    </div>--%>

<%--    <div class="layui-form-item">--%>
<%--        <label class="layui-form-label required">菜单图片</label>--%>
<%--        <div class="layui-input-block">--%>
<%--            <input type="file" name="file">--%>
<%--        </div>--%>
<%--    </div>--%>

<%--    <div class="layui-form-item">--%>
<%--        <label class="layui-form-label required">请求路径</label>--%>
<%--        <div class="layui-input-block">--%>
<%--            <input type="text" name="url" lay-verify="required" lay-reqtext="请求路径不能为空" placeholder="请输入请求路径" value=""--%>
<%--                   class="layui-input">--%>
<%--        </div>--%>
<%--    </div>--%>

<%--    <div class="layui-form-item">--%>
<%--        <label class="layui-form-label required">序号</label>--%>
<%--        <div class="layui-input-block">--%>
<%--            <input type="text" name="serial" lay-verify="number" lay-reqtext="序号不能为空" placeholder="请输入序号" value=""--%>
<%--                   class="layui-input">--%>
<%--        </div>--%>
<%--    </div>--%>

<%--    <div class="layui-form-item">--%>
<%--        <div class="layui-input-block">--%>
<%--            <button class="layui-btn layui-btn-normal" lay-submit lay-filter="saveBtn">确认保存</button>--%>
<%--        </div>--%>
<%--    </div>--%>
<%--</div>--%>

<form action="/backend/menu/addMenu" enctype="multipart/form-data" method="post">
    菜单名称：<input name="menuName">
    请求路径：<input name="url">
    序号：<input name="serial">
    菜单图片：<input type="file" name="file"><br/>
    <button type="submit">提交</button>
</form>

<script>
    $(document).ready(function () {

        layui.use(['form'], function () {
            var form = layui.form,
                layer = layui.layer,
                $ = layui.$;

            //监听提交
            form.on('submit(saveBtn)', function (data) {

                var formData = new FormData(document.getElementById("form"));
                console.log(formData);

                // var index = layer.alert(JSON.stringify(data.field), {
                //     title: ''
                // }, function () {
                //
                //     // 关闭弹出层
                //     layer.close(index);
                //
                //     var iframeIndex = parent.layer.getFrameIndex(window.name);
                //     parent.layer.close(iframeIndex);
                //
                // });
            });
            return false;
        });
    });
</script>
</body>
</html>
